<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateGoodsSkusTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('goods_skus', function (Blueprint $table) {
            $table->id();
            $table->integer('gid')->default(0)->comment('商品ID');
            $table->string('sku_no', 128)->default('')->comment('sku编码');
            $table->integer('stock')->default(0)->comment('库存');
            $table->integer('price')->default(0)->comment('价格');
            $table->integer('old_price')->default(0)->comment('原价');
            $table->string('cover')->default('')->comment('封面');
            $table->timestamps();
            $table->index('gid');
            $table->index('sku_no');
        });
        DB::statement("ALTER TABLE `goods_skus` comment '商品SKU表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('goods_skus');
    }
}
